<?php


namespace app\api\model;


use think\Model;

class Activity extends Model
{
    /**
     * 获取数据
     * @param $wdata
     * @return bool|false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function getAlist($wdata){
        return self::where($wdata)->field(true)->order("id desc")->select();
    }

    /**
     * 获取一条数据
     * @param $wdata
     * @return array|bool|false|\PDOStatement|string|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */

    public static function getAoneData($wdata){
        return self::where($wdata)->field(true)->find();
    }

    /**
     * @param $wdata
     * @return int|string
     * @throws \think\Exception
     */
    public static function getAwin($wdata){
        return db("activity_winning")->where($wdata)->count();
    }
}